package com.dk.controller;

import com.dk.config.DynamicDataSource;
import com.dk.mapper.UserMapper;
import com.dk.pojo.User;
import com.dk.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @ClassName TestController
 * @Description //TODO
 * @Author Eayon
 * @Date 2020/6/3 18:50
 * @Version 1.0
 */
@Controller
@RequestMapping("test")
public class TestController {

    @Autowired
    private UserService userService;

    @RequestMapping("findAll")
    @ResponseBody
    public List<User> findAll() {
        return userService.findAll();
    }

    @RequestMapping("addUser")
    @ResponseBody
    public Boolean addUser() {
        User user = new User();
        user.setName("Anne123");
        return userService.addUser(user);
    }
}
